var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var n in t) t.hasOwnProperty(n) && (e[n] = t[n]);
    })(e, t);
}, function(e, t) {
    function n() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, 
    new n());
}), a = this && this.__decorate || function(e, t, n, a) {
    var o, i = arguments.length, r = i < 3 ? t : null === a ? a = Object.getOwnPropertyDescriptor(t, n) : a;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(e, t, n, a); else for (var l = e.length - 1; 0 <= l; l--) (o = e[l]) && (r = (i < 3 ? o(r) : 3 < i ? o(t, n, r) : o(t, n)) || r);
    return 3 < i && r && Object.defineProperty(t, n, r), r;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("PetSkinView"), s = e("Global"), c = e("PetManager"), l = e("AudioManager"), d = e("GameData"), u = e("EggsManager"), p = e("DataManager"), h = e("LoadManager"), f = cc._decorator, g = f.ccclass, m = f.property, y = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.petSkinView = null, e.skeleton = null, e.particle = null, e.fillRange = 0, 
        e;
    }
    return i(e, t), e.prototype.onLoad = function() {
        (-1 != u.default.getInstance().checkEggPet(1) || c.default.getInstance().getConfig(1).form < 2) && this.node.destroy();
    }, e.prototype.onClick = function() {
        var e, t, n, a = this;
        u.default.getInstance().checkEggPet(1) && (l.default.getInstance().playAudio("按钮2"), 
        this.particle ? ((t = cc.instantiate(this.particle.node)).parent = this.node, (e = t.getComponent(cc.ParticleSystem)).autoRemoveOnFinish = !0, 
        e.resetSystem()) : ((t = new cc.Node()).parent = this.node, t.y = 50, n = t.addComponent(cc.ParticleSystem), 
        cc.resources.load("particle/dianji", cc.ParticleAsset, function(e, t) {
            n.file = t, h.default.getInstance().loadRes({
                url: "particle/dianji",
                type: cc.SpriteFrame
            }).then(function(e) {
                n.spriteFrame = e, n.resetSystem(), a.particle = n;
            });
        })), this.fillRange < .3 ? this.fillRange += .06 * Math.random() + .08 : this.fillRange < .8 ? this.fillRange += .04 * Math.random() + .06 : this.fillRange < 1 ? this.fillRange += .02 * Math.random() + .06 : (u.default.getInstance().updateEggPet(1), 
        s.G.tryPetIdx = 102, d.GD.lastPetDataIdx = d.GD.petDataIdx, d.GD.petDataIdx = 1, 
        p.default.getInstance().save(), l.default.getInstance().playAudio("点碎音效"), this.skeleton.setAnimation(0, "bazha", !1), 
        this.skeleton.setCompleteListener(function() {
            a.skeleton.setCompleteListener(null), a.node.destroy(), a.petSkinView.doEffect();
        })));
    }, e.prototype.start = function() {}, e.prototype.update = function() {
        this.fillRange < 1 && 0 < this.fillRange && (this.fillRange -= .005);
    }, a([ m(r.default) ], e.prototype, "petSkinView", void 0), a([ m(sp.Skeleton) ], e.prototype, "skeleton", void 0), 
    a([ g ], e);
}(cc.Component);

n.default = y;